// house_pkg/pages/room/index.ts
Page({
  data: {
    point: '',
    building: '',
    newArrBuilding: []
  },

  onLoad({
    point,
    building
  }) {
    console.log(point, building);
    this.pointBuilding(point, building)
  },
  pointBuilding(point, building) {
    // 假设我们有10个房间 我们就做一个for循环 遍历一下
    const arrBuilding = Math.floor(Math.random() * 10) + 1
    // 声明一个空数组来接收
    const newArrBuilding = []
    for (let i = 0; i < arrBuilding; i++) {
      // 当前楼栋有多少层
      const floor = Math.floor(Math.random() * 28) + 6
      // 房间号
      const room = Math.floor(Math.random() * 4) + 1
      // 进行字符串拼接 例如: 102 308 房间号
      const roomeid = [floor, 0, room].join('')
      console.log(roomeid) // 得到的是随机出来的房间号 但是我们这边可能不只有一间房 
      newArrBuilding.push(roomeid) // 把遍历出来的房间号放入一个空数组
    }
    console.log(newArrBuilding)
    this.setData({
      point,
      building,
      newArrBuilding
    })
  }
})